package io.github.tangwan.designpattern.creational.singleton;

/**
 * 懒汉-线程不安全
 * @author tangwan
 * @version V1.0
 * created on 2021/9/27 11:19
 * @since JDK 1.8
 */
public class Singleton1 {

    private static Singleton1 instance;

    private Singleton1() {
    }

    public static Singleton1 getInstance() {
        //这里存在线程安全问题
        if (instance == null) {
            instance = new Singleton1();
        }
        return instance;
    }

}
